﻿using Microsoft.WindowsAzure.StorageClient;

namespace Nardax.Azure.StorageClient
{
    public abstract class CloudQueueWrapperBase
    {
        protected CloudQueueWrapperBase(CloudQueue cloudQueue)
        {
            CloudQueue = cloudQueue;
        }

        public CloudQueue CloudQueue { get; private set; }

        public void Clear()
        {
            CloudQueue.Clear();
        }

        public void Create()
        {
            CloudQueue.Create();
        }

        public bool CreateIfNotExist()
        {
            return CloudQueue.CreateIfNotExist();
        }

        public void Delete()
        {
            CloudQueue.Delete();
        }

        public void DeleteMessage(string messageId, string popReceipt)
        {
            CloudQueue.DeleteMessage(messageId, popReceipt);
        }

        public void DeleteMessage(CloudQueueMessage message)
        {
            CloudQueue.DeleteMessage(message);
        }

        public bool Exists()
        {
            return CloudQueue.Exists();
        }

        public int RetreiveApproximateMessageCount()
        {
            return CloudQueue.RetrieveApproximateMessageCount();
        }

        public int? ApproximateMessageCount
        {
            get { return CloudQueue.ApproximateMessageCount; }
        }

        public string Name
        {
            get { return CloudQueue.Name; }
        }

        public ICloudQueueClient ServiceClient
        {
            get { return new CloudQueueClientWrapper(CloudQueue.ServiceClient); }
        }
    }
}